package com.example.chat.model;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;

@Entity
@Table(name = "VDOA011_COMPANY")
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@DynamicInsert
@DynamicUpdate
@NoArgsConstructor
public class Company extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 4113737359731482126L;
    @Id
    @GenericGenerator(name = "uuidG", strategy = "org.hibernate.id.UUIDGenerator")
    @GeneratedValue(generator = "uuidG")
    @Column(name = "DOA011_ID", length = 50)
    private String id;

    /**
     * 公司名称
     */
    @Column(name = "DOA011_NAME", length = 50)
    private String name;

    /**
     * 所属地区
     */
    @Column(name = "DOA011_REGION_ID", length = 50)
    private String regionId;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "DOA011_REGION_ID", updatable = false, insertable = false, foreignKey = @ForeignKey(name = "none"))
    private Region region;

    /**
     * 公司地址
     */
    @Column(name = "DOA011_ADDRESS", length = 50)
    private String address;

    /**
     * 是否已删除
     */
    @Column(name = "DOA011_DELETED")
    private Boolean deleted = false;
}
